import { Controller, Post, Get, Put, Del, Query, Body } from '@midwayjs/core';
import { Inject } from '@midwayjs/core';
import { SpatialFeatureService } from '../service/spatialFeatures.service'; // 导入 SpatialFeatureService
import { SpatialFeatureCreateDto, SpatialFeatureUpdateDto, SpatialFeatureQueryDto, SpatialFeatureDeleteDto } from '../dto/spatialFeatures.dto'; // 导入 DTO

@Controller('/spatial-features')
export class SpatialFeatureController {
  
  @Inject()
  spatialFeatureService: SpatialFeatureService;

  // 添加空间特征
  @Post('/add')
  async addSpatialFeature(@Body() params: SpatialFeatureCreateDto) {
    const result = await this.spatialFeatureService.addSpatialFeature(params);
    return result;
  }

  // 根据查询条件获取空间特征信息，支持分页
  @Get('/query')
  async findSpatialFeatures(@Query() query: SpatialFeatureQueryDto) {
    const result = await this.spatialFeatureService.findSpatialFeatures(query);
    return result;
  }

  // 更新空间特征
  @Put('/update')
  async updateSpatialFeature(@Body() params: SpatialFeatureUpdateDto) {
    const result = await this.spatialFeatureService.updateSpatialFeature(params);
    return result;
  }

  // 删除空间特征
  @Del('/delete')
  async deleteSpatialFeature(@Body() params: SpatialFeatureDeleteDto) {
    const result = await this.spatialFeatureService.deleteSpatialFeature(params);
    return result;
  }
}
